package shapes
{
	import flash.events.Event;
	
	import mx.core.UIComponent;

	public class CircleShape extends UIComponent
	{
		public function CircleShape()
		{
			super();
		}
		
		private var _color:uint;
		[Undoable]
		public function get color():uint
		{
			return _color;
		}
		[Bindable("colorChanged")]
		public function set color(value:uint):void
		{
			if (value !== _color)
			{
				_color = value;
				invalidateDisplayList();
				dispatchEvent(new Event("colorChanged"));
			}
		}
		
		[Undoable]
		[Bindable(event="alphaChanged")]
		override public function set alpha(value:Number):void
		{
			super.alpha = value;
		}

		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
		{
			this.graphics.clear();
			this.graphics.beginFill(_color,alpha);
			this.graphics.drawCircle(width/2,width/2,width/2);
			this.graphics.endFill();
		}

	}
}